home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / tptc17tc.zip / ACKER.PAS next >
Pascal/Delphi Source File  |  1988-03-25  |  369b  |  27 lines

  1.  
  2. (*
  3.  *   Ackerman function
  4.  *)
  5.  
  6. program Acker;
  7.  
  8. Var
  9.   R : Integer;
  10.  
  11.   function A(M, N : Integer) : Integer;
  12.   begin
  13.     if M = 0 then
  14.       A := N+1
  15.     else
  16.       if N = 0 then
  17.         A := A(M-1, 1)
  18.       else
  19.         A := A(M-1, A(M, N-1));
  20.   end;
  21.  
  22. begin
  23.   WriteLn('Ackerman function...');
  24.   R := A(3, 6);
  25.   WriteLn('finished, R=',R);
  26. end.
  27.